/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.business.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import me.zhengjie.base.BaseBusiness;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Objects;

/**
* @website https://el-admin.vip
* @description /
* @author xiahongbo
* @date 2022-08-03
**/
@Entity
@Data
@Table(name="BIS_ORDER")
public class Order extends BaseBusiness implements Serializable {

    @Id
    @GenericGenerator(name = "hibernate-uuid", strategy = "uuid")
    @GeneratedValue(generator = "hibernate-uuid")
    @Column(name = "BIS_ORDER_ID")
    @ApiModelProperty(value = "主键ID")
    private String bisOrderId;

    @Column(name = "BIS_ORDER_ZHID")
    @ApiModelProperty(value = "照护ID")
    private Long bisOrderZhid;

    @Column(name = "BIS_ORDER_FAID")
    @ApiModelProperty(value = "方案ID")
    private String bisOrderFaid;

    @Column(name = "BIS_ORDER_HLRQ")
    @ApiModelProperty(value = "护理日期")
    private String bisOrderHlrq;

    @Column(name = "BIS_ORDER_HLY_ID")
    @ApiModelProperty(value = "护理员ID")
    private Long bisOrderHlyId;

    @Column(name = "BIS_ORDER_HLY_NAME")
    @ApiModelProperty(value = "护理员姓名")
    private String bisOrderHlyName;

    @Column(name = "BIS_ORDER_SERVICE_TYPE")
    @ApiModelProperty(value = "服务类别")
    private String bisOrderServiceType;

    @Column(name = "BIS_ORDER_START_TIME")
    @ApiModelProperty(value = "起始钟点")
    private String bisOrderStartTime;

    @Column(name = "BIS_ORDER_END_TIME")
    @ApiModelProperty(value = "结束钟点")
    private String bisOrderEndTime;

    @Column(name = "BIS_ORDER_JD")
    @ApiModelProperty(value = "经度")
    private String bisOrderJd;

    @Column(name = "BIS_ORDER_WD")
    @ApiModelProperty(value = "纬度")
    private String bisOrderWd;

    @Column(name = "BIS_ORDER_ZT")
    @ApiModelProperty(value = "状态")
    private String bisOrderZt;

    @Column(name = "BIS_ORDER_HLSTART")
    @ApiModelProperty(value = "护理开始时间")
    private Date bisOrderHlstart;

    @Column(name = "BIS_ORDER_HLEND")
    @ApiModelProperty(value = "护理结束时间")
    private Date bisOrderHlend;

    @Column(name = "BIS_ORDER_HLSC")
    @ApiModelProperty(value = "护理时长")
    private String bisOrderHlsc;

    @Column(name = "BIS_ORDER_PJZT")
    @ApiModelProperty(value = "评价状态")
    private String bisOrderPjzt;

    @Column(name = "BIS_ORDER_XJZT")
    @ApiModelProperty(value = "相机状态")
    private String bisOrderXjzt;

    @Column(name = "BIS_ORDER_DWZT")
    @ApiModelProperty(value = "定位状态")
    private String bisOrderDwzt;

    @Column(name = "BIS_ORDER_RLZT")
    @ApiModelProperty(value = "人脸状态")
    private String bisOrderRlzt;

    @OneToOne
    @JoinColumn(name="BIS_ORDER_ZHID", referencedColumnName="BIS_ZHSQ_ID",insertable = false,updatable = false)
    private Zhsq zhsq;

    @OneToMany
    @JoinColumn(name="BIS_ORDER_ID", referencedColumnName="BIS_ORDER_ID")
    private List<OrderMx> orderMxList;

    public void copy(Order source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
    @Override
    public int hashCode() {
        return Objects.hash(bisOrderId, bisOrderZhid, bisOrderFaid);
    }
}